/**
 *
 * @param fileName {string} 文件名
 * @param blob {Blob} blob 文件对象
 */
export function downloadBlob(fileName = "file",blob){
    let aLink = document.createElement('a');
    aLink.href = window.URL.createObjectURL(blob);
    aLink.download = fileName || ''; // HTML5新增的属性，指定保存文件名，可以不要后缀，注意，file:///模式下不会生效
    let event;
    if (window.MouseEvent) {
        event = new MouseEvent('click');
    } else {
        event = document.createEvent('MouseEvents');
        event.initMouseEvent('click', true, false, window, 0,
            0, 0, 0, 0, false, false,
            false, false, 0, null);
    }
    aLink.dispatchEvent(event);
    window.URL.revokeObjectURL(aLink.href);
}